package com.my.yc;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.io.PrintWriter;

@WebServlet(name = "demo", value = "/demo")
public class demo extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        // response ==> 响应对象
        // request ==> 请求对象
        // 获取 name 参数
        final String name = request.getParameter("name");
        //获取输出流
        final PrintWriter writer = response.getWriter();
        writer.print("hello ");
        writer.println(name);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }
}
